<div id="recent_activity">
    <h3>Recent activity</h3>
    <? foreach ($recent_posts as $recent_post):
        if ($recent_post->type == "message"):?>
            <div class="message">
                <h4>Message @ <?=date('d/m/Y H:i', strtotime($recent_post->date_posted));?></h4>
                <?=abbreviate($recent_post->message_content, 100);?>
            </div>
        <?endif;?>

        <? if ($recent_post->type == "poll"):?>
            <div class="poll">
                 <h4>Poll @ <?=date('d/m/Y H:i', strtotime($recent_post->date_posted));?></h4>
                <?=abbreviate($recent_post->poll_topic, 100);?>
            </div>
        <?endif;?>

        <? if ($recent_post->type == "event"):?>
            <div class="event">
                 <h4>Event @ <?=date('d/m/Y H:i', strtotime($recent_post->date_posted));?></h4>
                <?=abbreviate($recent_post->event_title, 100);?>
            </div>
        <?endif;?>


     <?endforeach; ?>
</div>